Real Ray Tracing

This package provides several basic functions for tracing real rays.

The following traces a real ray through the surfaces with initial height y and initial angle U.

y = 7.0
U = 0.05
raytrace(surfaces, y, U, RealRay)
RealRay{Tangential}.yu:
9×2 Matrix{Float64}:
 7.0       0.05
 7.0811   -0.147939
 6.8031   -0.255796
 6.4454   -0.0829576
 6.22165   0.127341
 6.35867   0.127341
 6.47454   0.084075
 6.76106   0.0549685
 6.85625  -0.0945211

And this finds the real marginal ray.

trace_marginal_ray(system)
RealRay{Marginal}.yu:
10×2 Matrix{Float64}:
 8.75271   0.0
 8.75271  -0.227507
 8.54797  -0.393639
 8.1085   -0.139238
 7.58814   0.10265
 7.63      0.10265
 7.72323   0.0678096
 7.98883   0.0346842
 8.01798  -0.166199
 0.0      -0.166199

In addition, the amount of spherical aberration produced from a real ray trace can be quantifed.

The following computes the transverse ray errors and returns vectors with the ray heights at the exit pupil and the ray errors at the paraxial plane.

y, ε = TSA(system)
ε[end]
0.3956026978785916

These can then be used to approximate, using linear least squares, the coefficients to a tangential ray aberration expansion of the form:

ε = By³ + Cy⁵ + Dy⁷ …

degree = 9
SA(y, ε, degree)
4-element Vector{Float64}:
 -0.2357938671173554
  0.4240365265953136
  0.0026313526456189927
  0.204612037706508